/*
* Copyright @2009-2012 www.happyelements.com, all rights reserved.
* Create date: 2012-7-27
* Piggy Dong
* 董文弈
* wenyi.dong@happyelements.com
*/
package com.happyelements.isolib
{
	import flash.geom.Point;

	/**
	 * @author dongpiggyi
	 */
	public class IsoTileObject
	{
		private var _displayObject:Object;

		private var _rowIndex:int;

		private var _columnIndex:int;

		private var _rows:int;

		private var _columns:int;

		public function IsoTileObject(rowIndex:int, columnIndex:int, rows:int = 1, columns:int = 1)
		{
			_rowIndex = rowIndex;
			_columnIndex = columnIndex;
			_rows = rows;
			_columns = columns;
		}

		public function setDisplayObjectPosition(point:Point):void
		{
		}
		
		public function moveTo(rowIndex:int, columnIndex:int):void
		{
			this.rowIndex = rowIndex;
			this.columnIndex = columnIndex;
		}

		public function set displayObject(displayObject:Object):void
		{
			this._displayObject = displayObject;
		}

		public function get displayObject():Object
		{
			return this._displayObject;
		}

		public function get rowIndex():int
		{
			return _rowIndex;
		}

		public function set rowIndex(row:int):void
		{
			if(row < 0)
			{
				_rowIndex = 0;
			}
			else if(row > IsoWorld.instance.numWorldGrid - rows)
			{
				_rowIndex = IsoWorld.instance.numWorldGrid - rows;
			}
			else
			{
				_rowIndex = row;
			}
		}

		public function get columnIndex():int
		{
			return _columnIndex;
		}

		public function set columnIndex(column:int):void
		{
			if(column < 0)
			{
				_columnIndex = 0;
			}
			else if(column > IsoWorld.instance.numWorldGrid - columns)
			{
				_columnIndex = IsoWorld.instance.numWorldGrid - columns;
			}
			else
			{
				_columnIndex = column;
			}
		}

		public function get rows():int
		{
			return _rows;
		}

		public function set rows(rows:int):void
		{
			_rows = rows;
		}

		public function get columns():int
		{
			return _columns;
		}

		public function set columns(columns:int):void
		{
			_columns = columns;
		}
	}
}
